package com.ubb.damate.service.impl;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import com.ubb.damate.model.Event;
import com.ubb.damate.service.EventServiceLocal;
import com.ubb.damate.service.EventServiceRemote;

/**
 * Session Bean implementation class EventService
 */
@Stateless
public class EventService implements EventServiceRemote, EventServiceLocal {

	@PersistenceContext(unitName = "damate-pu")
	private EntityManager em;

	@Override
	public Event createOrUpdate(Event event) {
		return em.merge(event);
	}

	@Override
	public void delete(Event event) {
		 em.remove(em.merge(event));
	}

	@Override
	public Event find(Event event) {
		return em.find(com.ubb.damate.model.Event.class, event);
	}

}
